package Model.Wall;

import java.io.IOException;
import java.net.HttpURLConnection;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

//import org.json.JSONArray;
//import org.json.JSONObject;

/**
 * Servlet implementation class deletePostServlet
 */
@WebServlet("/deletePostServlet")
public class DeletePostServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		try {
			String postIDString = request.getParameter("id");
			int postID = Integer.parseInt(postIDString);
			Wall wall = new Wall();
			wall.deletePost(postID);

		} catch(Exception e) {
			e.printStackTrace(System.err);
			response.setStatus(HttpURLConnection.HTTP_INTERNAL_ERROR);
		}
	}


}
